#pragma once
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <iostream>
#include <unistd.h>
#include <cstdio>
#define path  "/home/xchild"
#define SIZE 4096

int GetShareMemHelper(int flag)
{
    key_t key = ftok(path,0x8888);
    std::cout << key << std::endl;
    int shmid = shmget(key,SIZE,flag);

    return shmid;
}

int CreateSID()
{
    return GetShareMemHelper(IPC_CREAT|IPC_EXCL|0666);
}

int GetSID()
{
    return GetShareMemHelper(IPC_CREAT);
}

